#include "../Core/Model.h"
#include "../Debug/Exceptions.h"

namespace epix {

Model::Model(const char *name, unsigned int VBSize, float *pos,
	unsigned int TBSize, float *tex,
	unsigned int NBSize, float *nor,
	unsigned int IBSize, unsigned int *indices) :
	IResource(name), _VBSize(VBSize), _TBSize(TBSize), _NBSize(NBSize), _IBSize(IBSize), _pos(pos), _tex(tex), _nor(nor), _indices(indices)
{
}

Model::~Model()
{
    if(_pos) delete[] _pos;
    if(_tex) delete[] _tex;
    if(_nor) delete[] _nor;
    if(_indices) delete[] _indices;
}

void Model::setVertices(float *pos, unsigned int VBSize)
{
	_pos = pos;
	_VBSize = VBSize;
}

void Model::setTexCoords(float *tex, unsigned int TBSize)
{
	_tex = tex;
	_TBSize = TBSize;
}

void Model::setNormals(float *nor, unsigned int NBSize)
{
	_nor = nor;
	_NBSize = NBSize;
}

void Model::setIndices(unsigned int *indices, unsigned int IBSize)
{
	_indices = indices;
	_IBSize = IBSize;
}

unsigned int Model::getVBSize()
{
	return _VBSize;
}

unsigned int Model::getTBSize()
{
	return _TBSize;
}

unsigned int Model::getNBSize()
{
	return _NBSize;
}

unsigned int Model::getIBSize()
{
	return _IBSize;
}
		
float *Model::getVertices() const
{
	return _pos;
}

float *Model::getTexCoords() const
{
	return _tex;
}

float *Model::getNormals() const
{
	return _nor;
}

unsigned int *Model::getIndices() const
{
    return _indices;
}

}

